package t20211227;

/**
 * @Author: DengJia
 * @Date: 2021/12/27 20:39
 * @Description:
 */

public class WhoCalled {
    static void f() {
        try {
            throw new NullPointerException();
        } catch (NullPointerException e) {
            for (StackTraceElement element : e.getStackTrace()) {
                // System.out.println(element.getMethodName());
                System.out.println(element);
            }
        }
    }

    static void g() {
        f();
    }

    static void h() {
        g();
    }

    public static void main(String[] args) {
        f();
        System.out.println("---------------------------------");
        g();
        System.out.println("---------------------------------");
        h();
    }
}
